package org.meiling.util;

import java.util.Random;

import javax.swing.ImageIcon;

public class Utils {
	public static final int WIDTH = 500;
	public static final int HEIGHT = 800;
	public static final int RECT_WIDTH = 48;
	public static final int RECT_HEIGHT = 48;
	public static ImageIcon bgFirstPage = null;
	public static ImageIcon bgGame= null;
	public static ImageIcon blue = null;
	public static ImageIcon green = null;
	public static ImageIcon orange = null;
	public static ImageIcon purple = null;
	public static ImageIcon red = null;
	public static Random rand = new Random();
	public static ImageIcon combo_1 = null;
	public static ImageIcon combo_2 = null;
	public static ImageIcon combo_3 = null;
	public static ImageIcon star = null;
	public static ImageIcon guoguan = null;
	public static ImageIcon menu_start = null;
	public static ImageIcon gameover = null;
	public static ImageIcon tubiao = null;
	public static ImageIcon jixu = null;

	static{
		bgFirstPage = new ImageIcon(Utils.class.getResource("images/bg_menuscene.png"));
		bgGame = new ImageIcon(Utils.class.getResource("images/bg_mainscene.png"));
		blue = new ImageIcon(Utils.class.getResource("images/blue.png"));
		green = new ImageIcon(Utils.class.getResource("images/green.png"));
		orange = new ImageIcon(Utils.class.getResource("images/orange.png"));
		purple = new ImageIcon(Utils.class.getResource("images/purple.png"));
		red = new ImageIcon(Utils.class.getResource("images/red.png"));
		combo_1 = new ImageIcon(Utils.class.getResource("images/combo_1.png"));
		combo_2 = new ImageIcon(Utils.class.getResource("images/combo_2.png"));
		combo_3 = new ImageIcon(Utils.class.getResource("images/combo_3.png"));
		star = new ImageIcon(Utils.class.getResource("images/star.png"));
		guoguan = new ImageIcon(Utils.class.getResource("images/stage_clear.png"));
		menu_start = new ImageIcon(Utils.class.getResource("images/menu_start.png"));
		gameover = new ImageIcon(Utils.class.getResource("images/GameOver.png"));
		tubiao = new ImageIcon(Utils.class.getResource("images/tubiao.png"));
		jixu = new ImageIcon(Utils.class.getResource("images/menu_continue.png"));
	}
	
	
	//计算方块得分
	public static int calc(int lianji){
		if (lianji==2) {
			return 20;
		}
		if (lianji>2) {
			int num=0;
			lianji--;
			num+=lianji*10+5;
			num+=calc(lianji);
			return num;
		}
		return 0;
	}

	//计算过关分
	public static int needNum(int lv){
		if (lv==1) {
			return 1000;
		}
		if (lv==2) {
			return 3000;
		}
		int num = 0;
		if (lv>2) {
			lv--;
			num +=3000;
			num+=needNum(lv);
			return num;
		}
		return 0;
	}

}
